/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hibernate.dao;

import hibernate.entity.Centers;
import java.util.List;

/**
 *
 * @author NDH
 */
public class CenterDAO extends AbstractDAO {

    /**
     * @return List<Centers>
     * @see a list of centers in the University
     */
    public List<Centers> readAll() {
        query = session.createQuery("from Centers");
        return query.list();
    }

    /**
     * @param parseInt present for an entered centerid to get an corrective
     * center
     * @return Centers
     * @see a list of centers in the University
     */
    public Centers readByID(int parseInt) {
        try {
            query = session.createQuery("from Centers where centerId = :id");
            query.setParameter("id", parseInt);
            return (Centers) query.list().get(0);
        } catch (Exception e) {
            return null;
        }
    }
}
